﻿/*
1001 A+B Format (20 分)
Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).

Input Specification:
Each input file contains one test case. Each case contains a pair of integers a and b where −10
​6
​​ ≤a,b≤10
​6
​​ . The numbers are separated by a space.

Output Specification:
For each test case, you should output the sum of a and b in one line. The sum must be written in the standard format.

Sample Input:
-1000000 9
Sample Output:
-999,991
*/

#pragma warning(disable:4267)
#pragma warning(disable:4996)
#pragma warning(disable:6031)
#pragma warning(disable:6011)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

namespace E1001_A_plus_B_Format {
int main();

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

typedef struct LNode* PtrToLNode;
struct LNode {
	int data;
	struct LNode* next;
};
typedef PtrToLNode LinkedList;

typedef struct SStack* PtrToSStack;
struct SStack {
	LinkedList front;
};
typedef PtrToSStack Stack;

Stack stack_create() {
	Stack s = (Stack)malloc(sizeof(struct SStack));
	s->front = NULL;
	return s;
}

Stack stack_push(Stack s, int data) {
	assert(s);
	PtrToLNode node = (PtrToLNode)malloc(sizeof(struct LNode));
	node->data = data;
	node->next = s->front;
	s->front = node;
	return s;
}

int stack_pop(Stack s) {
	assert(s);
	int data;
	PtrToLNode node = s->front;
	s->front = node->next;
	data = node->data;
	free(node);
	return data;
}

void format(int c) {
	int a, e;
	SStack stack_data = {};
	Stack stack = &stack_data;
	const int mod = 1000;
	if (c < 0) {
		a = -1;
		c = -c;
	}
	else {
		a = 1;
	}

	while (c > 0) {
		e = c % mod;
		c = c / mod;
		stack_push(stack, e);
	}
	if (a < 0)
		printf("-");
	a = 0;
	while (stack->front) {
		c = stack_pop(stack);
		if (a > 0)
			printf(",%03d", c);
		else {
			a = 1;
			printf("%d", c);
		}
	}
	printf("\n");
}

int main() {
	int a, b;
	SStack stack_data = {};
	Stack stack = &stack_data;
	const int mod = 1000;
	scanf("%d %d", &a, &b);
	format(a + b);
	return 0;
}

}

int main_E1001_A_plus_B_Format() {
	return E1001_A_plus_B_Format::main();
}